home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
003.dms
/
003.adf
/
TEXT
/
chapter8.txt
< prev
next >
Wrap
Text File
|
1992-09-02
|
5KB
|
238 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter eight
-------------
In this chapter we are going to cover three fairly easy commands and have
the second of our self testing quizzes, so take it easy, relax, learn and
enjoy yourself.
REM A small program to demonstrate the CHANGE MOUSE command
CURS OFF: PAPER 8: PEN 0: CLS 8
CENTRE "A DEMO OF CHANGE MOUSE"
PEN 3
LOCATE 0,10: CENTRE "NORMAL MOUSE POINTER"
WAIT 200
LOCATE 0,10: CENTRE "THE CROSS HAIR POINTER"
CHANGE MOUSE 2
WAIT 200
LOCATE 0,10: CENTRE "CLOCK MOUSE POINTER YUK!"
WAIT 200
EDIT
The breakdown:
The first line should be familiar to you except for one command.
PEN 0
-----
PEN N, sets the colour of the text you want to print to the screen, do not
confuse with PAPER N which controls the background colour of the text.
PENs N can be any colour 0-15 the same as PAPER, the numbers 0-15 are the
colour indexes and as we are using the Amos default screen which contains
16 colours, 0-15 inclusive, we are OK. I will show you later how to create
your own custom screens of different sizes and colours, but don`t think
about that for now.
CENTRE "A DEMO OF CHANGE MOUSE"
-------------------------------
I like the CENTRE command it does a lot of work for one simple command, as
you have probably guessed CENTRE centres a string of text on the screen.
It always uses the current cursor position so if we had a program that did
the following, what do you think would happen?
CENTRE "WIBBLE"
CENTRE "MORE TEXT"
What would happen is all that would appear on screen is MORE TEXT because
it would overwrite WIBBLE as the cursor position is unmoved if we did this,
CENTRE "WIBBLE"
PRINT
CENTRE "MORE TEXT"
We would see this on screen,
WIBBLE
MORE TEXT
Because the PRINT statement moved the cursor down a line.
You can also CENTRE a string variable using CENTRE if you want like this,
A$="WIBBLE BOTTOM"
CENTRE A$
Right that`s enough about CENTRE there is more info on this in EXAMPLE8.Amos
PEN 3
-----
Yes this is interesting, we have just covered PEN N, but I left out the
juicy bit until we got to the actual line. The PEN 3 command sets the
text colour to 3, fair enough, but colour 3 is set by default to flash!
This is useful for drawing attention to text as you will see in EXAMPLE8.Amos
We can stop colour 3 from flashing by using the FLASH OFF comand.
CHANGE MOUSE 2
--------------
This command, as if you didn`t know CHANGEs the MOUSE pointer as follows:
CHANGE MOUSE 1 REM The default (horrid) orange pointer
CHANGE MOUSE 2 REM The cross hair pointer
CHANGE MOUSE 3 REM The Clock pointer
There are other ways to change the mouse pointer, which I may cover later
but this is the easiest way for now.
Everything else in the program should by now be self explanatory.
What you should understand since the last Notes list.
-----------------------------------------------------------------
*Please note the following is not a program.
ANY: : A label, a marker to tell GOTO amongst others, where to jump to
BELL : Make a bell type sound
BOOM : Make an explosion type sound
CENTRE $ : CENTRE a string of text on current line
CHANGE MOUSE N : CHANGE the mouse pointer 1,2 or 3. 1 is default
FLASH OFF : Unset colour 3 so it does not FLASH
GOTO : GOTO a previously defined Label
LOCATE N,N : Set text cursor to position N across and N down
PEN N : Set the color of any text, PEN 3 FLASHes by default
RND (N) : Generate a RaNDom number between 0 and N-1
SHOOT : Make a gun fire type sound
WAIT N : Halt program for N*50ths of a second
------------------------------------------------------------------
SELF TESTING QUIZ Part 2
==========================
You can refer to your notes if you need them.
Make a note of each answer a,b or c, answers next chapter.
Q 1. What is wrong with the following piece of code?
LABEL
WAIT 1000
GOTO LABEL
a) The : is missing from LABEL
b) The 1000 in WAIT is too long
c) GOTO is spelt wrong
Q 2. Name the three built in sound effects
a) BULL, BLOOM, SHUT
b) BELL, BOOM, SHOOT
c) BELL, BUM, SHOT
Q 3. How would you CENTRE the following text on the screen?
"MORE TEXT"
a) CENTRE MORE TEXT
b) "MORE TEXT"; CENTRE
c) CENTRE "MORE TEXT"
Q 4. How many CHANGE MOUSE options are there (that we have covered so far)?
a) 1
b) 2
c) 3
Q 5. What colour is set to FLASH as default?
a) 2
b) 3
c) 4
Q 6. What is the correct code to set the text cursor to 5 across 3 down?
a) LOCATE 5,5
b) PEN 5,3
c) LOCATE 5,3
Q 7. What range of random numbers would this produce?
RND (9)
a) 0 to 8
b) 0 to 9
c) 1 to 9
Q 8. How long would this halt the program for?
WAIT 50
a) 1 minute
b) 1/50th of a second
c) 1 second
Q 9. How would you stop colour 3 from FLASHing?
a) STOP FLASH
b) FLASH OFF
c) NO FLASH
Q10. What would appear on the screen when you run this program?
CENTRE "SOME TEXT"
CENTRE "EVEN MORE"
a) SOME TEXT
b) EVEN MORE
c) NOTHING
End of chapter eight.